/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.config.javabeans;

import java.io.Serializable;

/**
 * Class corresponding to the "orgChartAtt" element of views.xml.
 * This is a list of attributes to be used in orgchart generation for the corresponding object.
 */
public class JBOrgChartAtt implements Serializable
{
    /** Photo typed attribute. */
    public static final String TYPE_PHOTO = "photo";

    /** Name typed attribute. */
    public static final String TYPE_NAME = "name";

    /** Attribute name. */
    private String name;

    /** Attribute type. */
    private String type;

    /** Creates new orgchart attribute. */
    public JBOrgChartAtt()
    {
    }

    /**
     * Returns the attribute name.
     * @return attribute name
     */
    public String getName()
    {
        return name;
    }

    /**
     * Sets the attribute name.
     * @param aname The name to set
     */
    public void setName(String aname)
    {
        this.name = aname;
    }

    /**
     * Displays the object.
     *
     * @return String representation of the object.
     */
    @Override
	public String toString()
    {
        StringBuffer buf = new StringBuffer();
        java.util.Iterator it = null;

        buf.append("   name = ");
        buf.append(name);
        buf.append(System.getProperty("line.separator"));

        return buf.toString();
    }

    // end of toString method

    /**
     * Returns the attribute type.
     * @return attribute type
     */
    public String getType()
    {
        return type;
    }

    /**
     * Sets the attribute type.
     * @param atype The type to set
     */
    public void setType(String atype)
    {
        this.type = atype;
    }

    /**
     * Checks whether the attribute is photo typed.
     *
     * @return true if it is, false if it is not
     */
    public boolean isPhoto()
    {
        if (type == null)
        {
            return false;
        }
        if (type.compareToIgnoreCase(TYPE_PHOTO) == 0)
        {
            return true;
        }
        return false;
    }

    /**
     * Checks whether the attribute is name typed.
     *
     * @return true if it is, false if it is not
     */
    public boolean isDisplayName()
    {
        if (type == null)
        {
            return false;
        }
        if (type.compareToIgnoreCase(TYPE_NAME) == 0)
        {
            return true;
        }
        return false;
    }
}
